<?php

namespace app\admin\middleware;

class Auth
{

    public function handle($request, \Closure $next)
    {
        if (!session('?session_admin') && !preg_grep('/login/', [$request->pathinfo()])) {
            return redirect(url('login/index'));
        }

        return $next($request);;

//        $rep = $next($request);;
//        if (!session('?session_admin') && $request->controller() != 'Login') {
//            return redirect(url('login/index'));
//        }
//
//        return $rep;
    }
}
